Provide better default value for date in Gnus scoring
authorJakub Ječmínek <jecminek.k@gmail.com>
Sat, 17 Feb 2024 17:34:36 +0000 (09:34 -0800)
committerEric Abrahamsen <eric@ericabrahamsen.net>
Sat, 17 Feb 2024 17:41:31 +0000 (09:41 -0800)
Bug#61002, thanks to Kamil Jońca for reporting

* lisp/gnus/gnus-score.el (gnus-summary-score-entry): When scoring on
Date header, the default value for the prompt should be number of days
between the date of the article under point, and "now".

lisp/gnus/gnus-score.el

index bd19e7d7cd7c08cee88b03574d11dc8a83d454f1..479b7496cf17e9c1b26f037604256d7f2b073d08 100644 (file)
@@ -893,9 +893,14 @@ If optional argument `EXTRA' is non-nil, it's a non-standard overview header."
                                 (t "permanent"))
                           header
                           (if (< score 0) "lower" "raise"))
-                  (if (numberp match)
-                      (int-to-string match)
-                    match))))
+                   (cond ((numberp match) (int-to-string match))
+                         ((string= header "date")
+                          (int-to-string
+                           (-
+                            (/ (car (time-convert (current-time) 1)) 86400)
+                            (/ (car (time-convert (gnus-date-get-time match) 1))
+                               86400))))
+                         (t match)))))
 
     ;; If this is an integer comparison, we transform from string to int.
     (if (eq (nth 2 (assoc header gnus-header-index)) 'gnus-score-integer)